package com.stox.charting.ui.swing.event.listener;

import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;

import com.stox.charting.ui.swing.view.ChartView;
import com.stox.charting.ui.swing.view.ChartingInternalFrameView;

public class ChartingInternalFrameViewResizeListener 
	extends ComponentAdapter {

	@Override
	public void componentResized(ComponentEvent e) {
		ChartingInternalFrameView view = (ChartingInternalFrameView)e.getSource();
		for(int i = 0; i < view.getPriceChartView().getChartCount(); i++){
			view.getPriceChartView().getChart(i).getModel().fireChartModelChangedEvent("uiUnits");
		}
		for(ChartView chartView : view.getIndicatorChartViews()){
			for(int i = 0; i < chartView.getChartCount(); i++){
				chartView.getChart(i).getModel().fireChartModelChangedEvent("uiUnits");
			}
		}
		view.repaintChartViews();
	}

}
